package com.example.weatherforecast.data.city.persistence

import com.fasterxml.jackson.annotation.JsonProperty

data class CityRequestInfo(
    @JsonProperty("levelOne")
    val levelOneDTO: LevelOneDTO,
    @JsonProperty("levelTwo")
    val levelTwoDTO: LevelTwoDTO,
    @JsonProperty("levelThree")
    val levelThreeDTO: LevelThreeDTO
) {

    var levelOneCityMap = HashMap<String, String>()
    var levelTwoCityMap = HashMap<String, String>()
    var levelThreeCityMap = HashMap<String, String>()

}

data class LevelOneDTO(
    @JsonProperty("url")
    val url: String)

data class LevelTwoDTO(
    @JsonProperty("url")
    val url: String,
    @JsonProperty("provinceId")
    val provinceId: String,
    @JsonProperty("urlSuffix")
    val urlSuffix: String
) {

    fun getRequestUrl(provinceId: String): String {
        return url + provinceId + urlSuffix
    }

}

data class LevelThreeDTO(
    @JsonProperty("url")
    val url: String,
    @JsonProperty("cityId")
    val cityId: String,
    @JsonProperty("urlSuffix")
    val urlSuffix: String
){

    fun getRequestUrl(cityId: String): String {
        return url + cityId + urlSuffix
    }

}